<?php 

class Charts extends CI_Controller {

	function Charts()
	{
		parent::__construct();

		$this->view_data = array();
		$this->load->model('helpdesk_model');
	}

	function index()
	{
		$this->compare_helpdesk(2013);
	}

	function compare_helpdesk($tahun)
	{
		$bulan = 1;
		while ($bulan <=12) {
			$requested = $this->helpdesk_model->count_requested_helpdesk($bulan,$tahun);
			foreach ($requested -> result() as $row_requested) {
				$request[] = $row_requested->JUMLAH;
			}
			$solved = $this->helpdesk_model->count_solved_helpdesk($bulan,$tahun);
			foreach ($solved -> result() as $row_solved) {
				$solve[] = $row_solved->JUMLAH;
			}
		$bulan++;
		}

		$data['request'] = $request;
		$data['solved'] = $solve;
		$data['tahun'] = $tahun;
		$data['content'] = $this->load->view('view_charts', $data, true);
		$this->load->view('main',$data);

	}
}
